package com.freshcity.page.wait
{
	import com.freshcity.component.container.Component;
	import com.freshcity.graphics.LineListWin;
	import com.greensock.TweenLite;
	
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	public class LineList extends Component
	{
		public var owner:RoomList;
		private var _lineList:Array=[];
		private var background:LineListWin;
		
		public function LineList(parent:DisplayObjectContainer,xpos:Number=0,ypos:Number=0)
		{
			this.mouseEnabled = false;
			super(parent,xpos,ypos);
		}		
		
		override protected function addChildren():void
		{
			super.addChildren();
			background = new LineListWin();
			addChild(background);
			background.closeBtn.addEventListener(MouseEvent.CLICK,onCloseWinHandler);
		}
		
		protected function onCloseWinHandler(event:MouseEvent):void
		{
			owner.win.tipMsg.text = "选择不同风格建筑，认识志同道合的新朋友。";
			var myfun:Function = function():void{
				owner.win.removeChild(owner.lineBox);
			};
			TweenLite.to(this,0.5,{onComplete:myfun,x:390});
		}
		
		override public function draw():void
		{
			super.draw();
		}
		
		public function onShow(data:*):void
		{
			var s:LineInfo;
			var xpos:int=10;
			var ypos:int;
			
			var mainSprite:Sprite = new Sprite();
			
			for each (var d:* in data)
			{
				s=new LineInfo(d.line,d.room,xpos,ypos);
				s.owner=owner;
				mainSprite.addChild(s);
				ypos += 110;
			}
			this.background.panel.source=mainSprite;
		}
		
	}
}
